package com.zhuxi.filter;

import com.zhuxi.util.RequestIpHolder;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
@WebFilter(urlPatterns = "/*")
public class RequestFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        String ip = servletRequest.getRemoteAddr();
        RequestIpHolder.t.set(ip);
        filterChain.doFilter(servletRequest,servletResponse);
    }
}
